struct Point{
int x, y;
friend std::size_t hash_value(const Point& obj){
std::size_t seed=0x725C686F;
boost::hash_combine(seed, obj.x);
boost::hash_combine(seed, obj.y);
return seed;
}
};
struct Line{
Point start, end;
friend std::size_t hash_value(const Line& obj){
std::size_t seed=0x719E6B16;
boost::hash_combine(seed, obj.start);
boost::hash_combine(seed, obj.end);
return seed;
}
};
static map<size_t, Points> cache;
virtual Points::iterator begin(){return cache[line_hash].begin();}
virtual Points::iterator end(){return cache[line_hash].end();}
LineToPointCachingAdapter(Line& line){
static boost::hash<Line> hash;
line_hash=hash(line);
if(cache.find(line_hash)!=cache.end()) return;
Points points;
cache[line_hash]=points;
}